[include shell_command.cfg]
[include timelapse.cfg]
[include macro.cfg]
[include tmc.cfg]
[include clean.cfg]
[include filament.cfg]
[include adaptive_bed_mesh.cfg]
[include fluidd.cfg]
[include vibr_calibrate.cfg]


[delayed_gcode bed_mesh_init] 
initial_duration: .01
gcode: BED_MESH_PROFILE LOAD=default

[gcode_shell_command shaper_calibrate]
command: bash /home/pi/printer_data/config/shaper_calibrate.sh
timeout: 600.
verbose: True
[gcode_shell_command plot_graph]
command: bash /home/pi/printer_data/config/scripts/plot_graphs.sh
timeout: 500.0
verbose: True
[respond]

[gcode_arcs]

[adxl345]
cs_pin: PC15
spi_software_sclk_pin: PB13

spi_software_mosi_pin: PC3

spi_software_miso_pin: PC2
axes_map: x,-y,-z
[resonance_tester]
accel_chip: adxl345
probe_points:
    125, 100, 20

[mcu host]
serial: /tmp/klipper_host_mcu

[fan_generic camera_Fan]
pin: PB0
cycle_time: 0.05
kick_start_time: 0.5





[filament_switch_sensor filament_detection]
pause_on_runout: True
#   When set to True, a PAUSE will execute immediately after a runout
#   is detected. Note that if pause_on_runout is False and the
#   runout_gcode is omitted then runout detection is disabled. Default
#   is True.
runout_gcode: beep
#   A list of G-Code commands to execute after a filament runout is
#   detected. See docs/Command_Templates.md for G-Code format. If
#   pause_on_runout is set to True this G-Code will run after the
#   PAUSE is complete. The default is not to run any G-Code commands.
#insert_gcode:
#   A list of G-Code commands to execute after a filament insert is
#   detected. See docs/Command_Templates.md for G-Code format. The
#   default is not to run any G-Code commands, which disables insert
#   detection.
#event_delay: 3.0
#   The minimum amount of time in seconds to delay between events.
#   Events triggered during this time period will be silently
#   ignored. The default is 3 seconds.
#pause_delay: 0.5
#   The amount of time to delay, in seconds, between the pause command
#   dispatch and execution of the runout_gcode. It may be useful to
#   increase this delay if OctoPrint exhibits strange pause behavior.
#   Default is 0.5 seconds.
switch_pin: PA4
#   The pin on which the switch is connected. This parameter must be
#   provided.


[output_pin _Zummer]
pin: PA2 

[gcode_macro beep]
gcode:
  SET_PIN PIN=_Zummer VALUE=1   # в завершающем коде слайсера напиши в конце beep 
  G4 P5000                      # и тогда после окончания печати он тебе пикнет 4 раза. это 5 секунд работы,
  SET_PIN PIN=_Zummer VALUE=0 


[output_pin caselight]
pin: !PE6
value: 1


[input_shaper]

########## cam Fan #########

#[fan_generic camera_Fan]
#pin: PB0
#cycle_time: 0.05
#kick_start_time: 0.5







[stepper_x]
step_pin: PE3
dir_pin: !PE2
enable_pin: !PE4
microsteps: 16
rotation_distance: 40
endstop_pin: !PA15
position_endstop: 1
position_max: 255
homing_speed: 40

[stepper_y]
step_pin: PE0
dir_pin: !PB9
enable_pin: !PE1
microsteps: 16
rotation_distance: 40
endstop_pin: !PD2
position_endstop: 1
position_max: 220
homing_speed: 40

[stepper_z]
step_pin: PB5
dir_pin: !PB4
enable_pin: !PB8
microsteps: 32
rotation_distance: 8
#endstop_pin: !PC8
endstop_pin: probe:z_virtual_endstop
#position_endstop: 0.5
homing_speed: 40
second_homing_speed: 2
position_min: -10
position_max: 200

[extruder]
step_pin: PD6
dir_pin: PD3
enable_pin: !PB3
microsteps: 16
rotation_distance: 3.4334
max_extrude_only_distance: 1400.0
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PE5
sensor_type: Generic 3950
sensor_pin: PC1
min_temp: 0
max_temp: 320
pressure_advance = 0.042
min_extrude_temp: 0

[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0

min_temp: 0
max_temp: 130
[verify_heater heater_bed]
max_error: 130
check_gain_time: 80

[fan]
pin: PB1
off_below: 0.10
kick_start_time: 0.5

[heater_fan nozzle_fan]
pin: PC14
#kik_start_time: 0.1
shutdown_speed: 1.0
heater: extruder
heater_temp: 50
fan_speed: 1.0



[temperature_sensor orange_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100



[firmware_retraction]
retract_length: 0.4
retract_speed: 30
unretract_extra_length: 0
unretract_speed: 30

[mcu]
#serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_12345-if00
serial: /dev/ttyS3
restart_method: command
[mcu host]
serial: /tmp/klipper_host_mcu

[printer]
kinematics: corexy
max_velocity: 800
square_corner_velocity: 5.0
max_accel: 8000
max_accel_to_decel: 6000
max_z_velocity: 25
max_z_accel: 100

[bed_screws] # BED_SCREWS_ADJUST
screw1: 26,40
screw1_name: front left screw
screw2: 225,40
screw2_name: front right screw
screw3: 225,192
screw3_name: back right screw
screw4: 26,192
screw4_name: back left screw
speed: 150

[bltouch]

sensor_pin: ^PC4
control_pin: PA8
y_offset: 34.6
#z_offset: 2.0
x_offset: 24.4
speed: 10.0
samples: 3
samples_result: median
sample_retract_dist: 3.0
samples_tolerance: 0.15
samples_tolerance_retries: 3


[safe_z_home]
home_xy_position: 103,95                                                      # CAUTION! Depends on probe X/Y offset
z_hop: 10
move_to_previous: True                                                       # Return back ~X0/Y0 after Z0 at center
z_hop_speed: 10
speed: 50
[gcode_macro G29]
gcode:
    BED_MESH_CLEAR
    G28
    BED_MESH_CALIBRATE
    BED_MESH_PROFILE SAVE=name
    SAVE_CONFIG
    BED_MESH_PROFILE LOAD=name

[bed_mesh]
speed: 40
horizontal_move_z: 5
mesh_min: 30,40
mesh_max: 245,185
probe_count: 7,5
algorithm: bicubic
fade_start: 1
fade_end: 7
[screws_tilt_adjust]                                                          
screw4: 5,5                
screw4_name: front left screw
screw1: 210,5                             
screw2: 210,170             
screw2_name: back right screw
screw3: 5,170        
screw3_name: back left screw
speed: 150
screw_thread: CW-M4


[exclude_object]


[virtual_sdcard]
path: ~/printer_data/gcodes

[pause_resume]

[display_status]

[gcode_macro SHUTDOWN_MACHINE]

gcode:
    {action_call_remote_method("shutdown_machine")}

[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
    SAVE_GCODE_STATE NAME=PAUSE_state
    BASE_PAUSE
    {% set X = params.X|default(10) %}
    {% set Y = params.Y|default(180) %}
    {% set E = params.E|default(2) %}
    {% set Z = params.Z|default(150) %}
    G91
    G1 E-{E} F2100
    G1 Z{Z}
    G90
    G1 X{X} Y{Y} F6000

[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
    {% set E = params.E|default(2) %}
    G91
    G1 E{E} F2100
    G90
    RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
    BASE_RESUME

[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
    TURN_OFF_HEATERS
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    BASE_CANCEL_PRINT
    M106 S0
    G91
    G1 Z5
    G90
    G1 X5 Y105
    M84

[gcode_macro PID_E]
gcode:
  {% set T = params.T|default(255) %}
  PID_CALIBRATE HEATER=extruder TARGET={T}

[gcode_macro PID_B]
gcode:
  {% set T = params.T|default(80) %}
  PID_CALIBRATE HEATER=heater_bed TARGET={T}

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 23.357
#*# pid_ki = 0.979
#*# pid_kd = 139.268
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 68.579
#*# pid_ki = 1.566
#*# pid_kd = 750.936
#*#
#*# [stepper_z]
#*# position_endstop = 0.250
#*#
#*# [input_shaper]
#*# shaper_type_x = mzv
#*# shaper_freq_x = 69.2
#*# shaper_type_y = mzv
#*# shaper_freq_y = 51
#*#
#*# [bltouch]
#*# z_offset = 0.550
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	-0.058750, -0.085000, -0.053750, -0.041250, -0.018750, -0.028750, -0.075000
#*# 	0.020000, 0.006250, -0.010000, -0.018750, -0.066250, -0.077500, -0.026250
#*# 	0.047500, 0.032500, 0.003750, 0.027500, -0.005000, -0.028750, 0.017500
#*# 	0.035000, 0.061250, 0.043750, 0.040000, -0.003750, -0.017500, 0.016250
#*# 	0.076250, 0.081250, 0.063750, 0.055000, 0.018750, -0.007500, -0.010000
#*# x_count = 7
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = bicubic
#*# tension = 0.2
#*# min_x = 30.0
#*# max_x = 244.98000000000002
#*# min_y = 40.0
#*# max_y = 185.0
